#!/bin/bash
#
#  File      : uninstall.sh 
#  Author    : cnscn
#  EMail     : 2003ysy@126.com
#  URL       : http://cnsdel.eliee.com
#  QQ        : 214363570
#  Time      : 2005-08-28 18:00 / 2004-11-30 14:26
#  Copyright : Cnsdel is free software, covered by the GNU General Public License
#              And you are welcome to change it and/or distribute copies of it under certain conditions
#

if [ "root" != $USER ]
then
    echo "Only root can unistall!"
    exit
fi

echo -ne "Are you sure to unintall? (y/n): "
read answer
if [ "y" != "$answer" ] && [ "Y" != "$answer" ]
then
      exit
fi


if [ -f /usr/local/bin/del ] 
then
   echo -ne "delete /usr/local/bin/del (y/n): "
   read answer
   if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
   then
        rm -f   /usr/local/bin/del
        echo 
        if [ 0 != $?  ]
        then
             echo "Error exit"
        fi
   fi
fi
  

if [ -f /usr/local/bin/undel ] 
then
    echo -ne "delete /usr/local/bin/undel (y/n): "
    read answer
    if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
    then
        rm -f   /usr/local/bin/undel
        echo
        if [ 0 != $?  ]
        then
             echo "Error exit"
        fi
    fi
fi


if [ -f /bin/del ]
then
     echo -ne "delete /bin/del (y/n): "
     read answer
     if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
     then
          rm -f   /bin/del
          echo
          if [ 0 != $?  ]
          then
               echo "Error exit"
          fi
     fi
fi
 

if [ -f /bin/undel ]
then
     echo -ne "delete /bin/undel (y/n): "
     read answer
     if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
        then
        rm -f   /bin/undel
        echo
        if [ 0 != $?  ]
        then
             echo "Error exit"
        fi
     fi
fi
 

if [ -f ~/bin/del ]
then
     echo -ne "delete ~/bin/del (y/n): "
     read answer
     if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
     then
          rm -f   ~/bin/del
          echo
          if [ 0 != $?  ]
          then
               echo "Error exit"
          fi
     fi
fi
 

if [ -f ~/bin/undel ]
then
     echo -ne "delete ~/bin/undel (y/n): "
     read answer
     if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
     then
          rm -f   ~/bin/undel
          echo
          if [ 0 != $?  ]
          then
               echo "Error exit"
          fi
     fi
fi


if [ -d /usr/local/bin/cnsdel ]
then 
     echo -ne "delete /usr/local/cnsdel (y/n): "
     read answer
     if [ "y" == "$answer" ] || [ "Y" == "$answer" ]
     then
          rm -fr   /usr/local/cnsdel
          echo 
          if [ 0 != $?  ]
          then
               echo "Error exit"
          fi
     fi
fi
